#include<iostream>
#include<algorithm>

using namespace std;

const int N=1e3+10;

int n,k,a[N];


bool cmp(int a,int b){
	return a>b;
}


int main()
{
	cin>>n>>k;
	
	for(int i=0;i<n;i++) cin>>a[i];
	
	sort(a,a+n,cmp);
	
	cout<<a[k-1]<<endl;
	
	return 0;
}
